home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Communication
/
NewsBase
/
Source
/
IPercentageView.m
< prev
next >
Wrap
Text File
|
1993-01-12
|
1KB
|
59 lines
/* Generated by Interface Builder */
#import "IPercentageView.h"
#import <dpsclient/wraps.h>
#import <appkit/graphics.h>
@implementation IPercentageView
- initFrame:(const NXRect *)frameRect
{
[super initFrame:frameRect];
iMin = 0.0;
iMax = 1.0;
return self;
}
- setMin:(float)amin max:(float)amax
{
iMin = amin;
iMax = amax;
if (iMin > iMax) {
fprintf(stderr,"IPercentageView: min is larger than max\n");
return nil;
}
return self;
}
- displayValue:(float)aval
{
iVal = aval;
return ([self display]);
}
- resetValue
{
[self setMin:0.0 max:0.0];
return ([self display]);
}
- drawSelf:(const NXRect *)rects :(int)rectCount
{
NXRect drawRect;
drawRect = *rects;
NXDrawGrayBezel(&bounds, NULL);
NXInsetRect(&drawRect, 2.0, 2.0);
if ((iMax-iMin) != 0) {
drawRect.size.width = drawRect.size.width * (iVal - iMin) / (iMax - iMin);
PSsetgray(NX_DKGRAY);
PSrectfill(drawRect.origin.x, drawRect.origin.y,
drawRect.size.width, drawRect.size.height);
}
return ([super drawSelf:rects :rectCount]);
}
@end